﻿Imports BUS
Imports DTO

Public Class frmcapnhatnhanvien

    Private Sub LoadNhanVien()
        dtgvnhanvien.Rows.Clear()
        Dim ds As New List(Of NhanVienDTO)()
        Dim bus As New NhanVienBUS()
        ds = bus.LayDSNhanVien()
        For i As Integer = 0 To ds.Count - 1
            dtgvnhanvien.Rows.Add(ds(i).MaNhanVien, ds(i).HoTen, ds(i).NgaySinh, ds(i).DiaChi, ds(i).DienThoai, ds(i).MaBangCap, ds(i).MaBoPhan, ds(i).MaChucVu)
        Next
    End Sub

    Private Sub btnthoat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnthoat.Click
        Me.Close()
    End Sub

    Private Sub btncapnhat_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btncapnhat.Click
        If dtgvnhanvien.CurrentRow.Index >= 0 Then
            Dim frm As New frmxlcapnhatnhanvien()
            frm.MaNhanVien = dtgvnhanvien.Item(0, dtgvnhanvien.CurrentRow.Index).Value
            If frm.ShowDialog() = Windows.Forms.DialogResult.OK Then
                LoadNhanVien()
            End If
        End If
    End Sub

    Private Sub frmcapnhatnhanvien_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        LoadNhanVien()
    End Sub
End Class